using System;
using System.Collections.Generic;
using System.ByteBuffer;
using tools;

namespace thirteen
{
    /// <summary>
    /// generate by msg tool
    /// 玩家请求比牌
    /// </summary>
	public class ReqVersusMsg : ReqMessage
	{
		//头墩牌型
		public int headCardsType;
		//头墩牌
		public List<int> headCards = new List<int>();
		
		//中墩牌型
		public int midCardsType;
		//中墩牌
		public List<int> midCards = new List<int>();
		
		//尾墩牌型
		public int tailCardsType;
		//尾墩牌
		public List<int> tailCards = new List<int>();
		

        public ReqVersusMsg() { }

        public ReqVersusMsg(int headCardsType, int midCardsType, int tailCardsType)
        {
            this.headCardsType = headCardsType;
            this.midCardsType = midCardsType;
            this.tailCardsType = tailCardsType;
        }

        
		public void write(object obj)
		{
            ByteBuffer b = obj as ByteBuffer;
			b.PushInt(headCardsType);
			b.PushInt(headCards.Count);

			foreach (var element in headCards)
			{
				b.PushInt(element);
				
			}
			b.PushInt(midCardsType);
			b.PushInt(midCards.Count);

			foreach (var element in midCards)
			{
				b.PushInt(element);
				
			}
			b.PushInt(tailCardsType);
			b.PushInt(tailCards.Count);

			foreach (var element in tailCards)
			{
				b.PushInt(element);
				
			}
			
		}

	    public void read(object obj)
		{
            MyConverter b = obj as MyConverter;
			headCardsType = b.toInt32();
			int headCards_length = b.toInt32();
			for (int i = 0; i < headCards_length; ++i)
			{
				headCards.Add(b.toInt32());
				
			}
			midCardsType = b.toInt32();
			int midCards_length = b.toInt32();
			for (int i = 0; i < midCards_length; ++i)
			{
				midCards.Add(b.toInt32());
				
			}
			tailCardsType = b.toInt32();
			int tailCards_length = b.toInt32();
			for (int i = 0; i < tailCards_length; ++i)
			{
				tailCards.Add(b.toInt32());
				
			}
			
		}

		public int Id
		{
            get { return 621115; }
		}

        public String Desc
        {
            get { return "玩家请求比牌"; }
        }
	}
}